import time

from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By

option = Options()
option.add_argument('--disable-blink-features=AutomationControlled')

if __name__ == '__main__':
    chrome = Chrome(options=option)
    chrome.get("https://kyfw.12306.cn/otn/resources/login.html")

    time.sleep(3)

    chrome.find_element(By.XPATH, '//*[@id="J-userName"]').send_keys('zlx7758521')
    chrome.find_element(By.XPATH, '//*[@id="J-password"]').send_keys('zlx945521')
    chrome.find_element(By.XPATH, '//*[@id="J-login"]').click()

    time.sleep(3)

    cookies = chrome.get_cookies()
    for cookie in cookies:
        print(cookie)
